package com.itheima.goods.mapper;

import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 功能描述 Mapper接口
 *
 * @auther TSV
 * @date 2021/8/16
 */

public interface BrandMapper {
    // 查询所有品牌
    @Select("select * from tb_brand")
    List<Brand> findAll();

    // 添加品牌

    @Insert("insert into tb_brand Values (#{id},#{name},#{image},#{letter},#{seq})")
    Integer add(Brand brand);

    // 根据id查询品牌
    @Select("select * from tb_brand where id = #{id}")
    Brand findById(Integer id);

    // 修改品牌
    @Update("update from tb_brand set name=#{name},image=#{image},letter=#{letter},seq=#{seq} where id =#{id}")
    Integer update(Brand brand);

    // 通过id删除
    @Delete("delete from tb_brand where id =#{id}")
    Integer delete(Integer id);
}
